import { Schema as _Schema, model } from "mongoose";
const Schema = _Schema;

const HomeworkSchema = new Schema({
    // name of question, to identify different question
    name: {
        type: String,
        required: true,
    },
    content: {
        type: String,
        required: true,
    },
    uploader: {
        type: Schema.Types.ObjectId,
        ref: 'user',
    },
    course: {
        type: Schema.Types.ObjectId,
        ref: 'course',
    },
    score: {
        type: Number,
        default: 0,
    },
    category: {
        type: String,
        required: true,
        default: "answer",
        enum: ['question', 'answer'],
    }
});

const Homework = model("homework", HomeworkSchema);

export default Homework;
